package apiday02homework;


import java.util.Scanner;

public class PracticeMorning {
    public static void main(String[] args) {
String str = "abc123_+=!@#$%^&*(){}<>?/:;'][[]]]123131312avaavvvcccbbb[";
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入一个字符：");
        String word  = scan.nextLine();
        int count = getCount(word,str);
        System.out.println(word+"字符出现的次数为："+count);

    }

    public static int getCount(String word,String str) {
        int count = 0,start = 0;
        while (str.indexOf(word, start)>=0)
            {
               start = str.indexOf(word, start)+1;
               count++;
           }

        return count;
    }
}
